Skip to content

Un-defer fan-out per-instance fixture 029#188

Merged
chris-colinsky merged 2 commits into
mainfrom
chore/un-defer-029-fan-out-metadata
Jun 24, 2026
Merged

Un-defer fan-out per-instance fixture 029#188
chris-colinsky merged 2 commits into
mainfrom
chore/un-defer-029-fan-out-metadata

Conversation

@chris-colinsky

Copy link
Copy Markdown
Member

What

Un-defers fixture 029 (caller-metadata fan-out per-instance) in the Langfuse conformance runner.

Why it was deferred

029 omits the collect_field/target_field/item_field the cross-cap adapter requires, and its inner subgraph ships no state: block. Beyond that, the augment-instance-middleware the harness uses for augment_metadata_from_field was non-functional: it indexed a build-time list by current_fan_out_index(), which returns None inside fan-out instance middleware (the ContextVar is set deeper, in node execution). That path was latent dead code, since 029 and 039 were its only users and both were deferred.

Changes

  • _synthesize_fan_out_aggregation: synthesize the adapter-required fan-out fields into a throwaway aggregation sink (029 asserts per-instance span metadata + sibling isolation, never the collected results) and seed the inner state.
  • _make_augment_instance_middleware: read each instance's item from its item_field slot in runtime state, so the augmentation fires before the inner spans open and lands on the instance's dispatch + inner spans.
  • Activate 029 in _LANGFUSE_FIXTURES; move it to _LANGFUSE_HARNESS_FIXTURES in test_observability.py.
  • Sharpen the 030/039 deferral notes to their precise blockers (030 needs a LangfuseObserver per-branch dispatch-span src change; 039 needs a runtime-state item lookup plus a new augment_metadata_from_outer_item directive). Both are follow-up PRs.

Test plan

  • uv run pytest "tests/conformance/test_observability_langfuse.py" -k 029 -> 1 passed.
  • Full tests/ -> 1460 passed. ruff + pyright clean.

Test-only; no behavior or pin change.

029's fan_out omits the collect_field/target_field/item_field the
cross-cap adapter requires, and its inner subgraph ships no state block.
Synthesize those into a throwaway aggregation sink (029 asserts
per-instance span metadata + sibling isolation, never the collected
results) and seed the inner state, then activate 029 in the Langfuse
conformance runner.

Rewrite _make_augment_instance_middleware to read each instance's item
from its item_field slot in runtime state. The prior approach indexed a
build-time list by current_fan_out_index(), which returns None inside
instance middleware (the ContextVar is set deeper, in node execution),
so the augmentation never fired -- latent because 029/039 were its only
users and both were deferred.

Sharpen the 030/039 deferral notes: 030 needs a LangfuseObserver
per-branch dispatch-span src change, 039 needs a runtime-state item
lookup plus a new augment_metadata_from_outer_item directive.
Copilot AI review requested due to automatic review settings June 24, 2026 23:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR activates observability conformance fixture 029 for the Langfuse runner by extending the Langfuse harness to (a) normalize fixture keys, (b) synthesize adapter-required fan-out aggregation/state fields, and (c) fix per-instance metadata augmentation so it runs in fan-out instance middleware.

Changes:

  • Moved fixture 029 into the Langfuse harness coverage set and removed it from the unit-tested/deferred list.
  • Added _synthesize_fan_out_aggregation to inject required fan-out fields + inner state seed for fixture 029.
  • Updated fan-out per-instance augmentation middleware to read the current item from runtime state (item_field) instead of a build-time list indexed by current_fan_out_index().

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tests/conformance/test_observability.py Marks fixture 029 as covered by the sibling Langfuse conformance runner rather than deferred/unit-only.
tests/conformance/test_observability_langfuse.py Activates fixture 029 and updates the Langfuse harness to synthesize missing fan-out/state requirements and fix per-instance augmentation middleware.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/conformance/test_observability_langfuse.py
Comment thread tests/conformance/test_observability_langfuse.py
From CoPilot review of #188:

- Make the inner-state synthesis additive: ensure item_field and the
  inferred response fields are declared whether or not the subgraph
  shipped its own state block. setdefault on the whole state block
  skipped a fixture that declares inner state without the item slot,
  which would fail strict-State validation when the engine writes it.
- Fail fast when augment_metadata_from_field is present but item_field
  is missing, rather than building a silent no-op middleware that hides
  a harness/fixture mismatch. Tighten the middleware signature to a
  non-optional item_field.
@chris-colinsky chris-colinsky merged commit c2f66ed into main Jun 24, 2026
5 checks passed
@chris-colinsky chris-colinsky deleted the chore/un-defer-029-fan-out-metadata branch June 24, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants